<script setup>
 import { ref } from 'vue'
 import MyTable from './component/MyTable.vue'
import MyTag from './component/MyTag.vue';
 
 // 商品列表 
 const goodsList = ref([
  {
    id: 101,
    picture:
    'https://yanxuan-item.nosdn.127.net/f8c37ffa41ab1eb84bff499e1f6acfc7.jpg',
    name: '梨⽪朱泥三绝清代⼩品壶经典款紫砂壶',
    tag: '茶具'
  },
  {
    id: 102,
    picture:
    'https://yanxuan-item.nosdn.127.net/221317c85274a188174352474b859d7b.jpg',
    name: '全防⽔HABU旋钮⽜⽪⼾外徒步鞋⼭宁泰抗菌',
    tag: '男鞋'
  },
  {
    id: 103,
    picture:
    'https://yanxuan-item.nosdn.127.net/cd4b840751ef4f7505c85004f0bebcb5.png',
    name: '⽑茸茸⼩熊出没，⼉童⽺羔绒背⼼73-90cm',
    tag: '⼉童服饰'
  },
  {
    id: 104,
    picture:
    'https://yanxuan-item.nosdn.127.net/56eb25a38d7a630e76a608a9360eec6b.jpg',
    name: '基础百搭，⼉童套头针织⽑⾐1-9岁',
    tag: '⼉童服饰'
  }
 ])
</script>

<template>
 <MyTable :data="goodsList">
    <!-- 1.表头 -->
    <template v-slot:title>
      <th>编号</th>
      <th>名称</th>
      <th>图⽚</th>
      <th width="100px">标签</th>
    </template>
    <!-- 2.内容 -->
    <template #row="obj">
      <td>{{ obj.idx + 1 }}</td>
      <td>{{ obj.data.name }}</td>
      <td>
        <img :src="obj.data.picture">
      </td>
      <td>
        <MyTag v-model="obj.data.tag">

        </MyTag>
      </td>
    </template>
 </MyTable>
</template>

<style lang="scss">
 #app {
  width: 1000px;
  margin: 50px auto;
  img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    vertical-align: middle;
  }
  td:last-child {
    width: 200px;
  }
}
</style>